<?php 
use Wdl\helper\webHelper;
// 这个是ajax提供后台数
defined('IN_IA') or exit('Access Denied');
global $_GPC, $_W;
load()->func('tpl');
$operation = !empty($_GPC['op']) ? $_GPC['op'] : 'city';	
 
$uniacid = webHelper::bindUniacid(); 
$openid = $_W['openid'];
$uid = $_W['member']['uid'];

/**
 * 自动补全小区
 */
if($operation == 'autovillage'){
    $q = htmlspecialchars($_GPC['keyword'] );
 
     $rs = pdo_fetchall("select id ,name ,area from ".tablename("kbwdl_area")." where name like '%$q%' and type=3");
     $string[]  = array('title'=>'请点击选择相匹配的小区');
 
     foreach($rs as $key=>$value){
             $title = '<span>'.$value["name"].'</span>（'.$value['area'].'）';
             $string[] = array('title'=>$title,'id'=>$value["id"],'inputname'=>$value["name"]);
 
     }
     echo json_encode(array('data'=>$string));
 
     exit;    
     
 }
 /**
  * 楼盘名称自动补全
  */
 elseif($operation =='communityauto'){
     $q = htmlspecialchars($_GPC['keyword'] );
 
     $rs = pdo_fetchall("select newshouse_id ,title,developer  from ".tablename('kbwdl_house_info')." where title like '%$q%' and uniacid='$uniacid'");
     $string[]  = array('title'=>'请点击选择相匹配的楼盘');
 
     foreach($rs as $key=>$value){
             $title = '<span>'.$value["title"].'</span>（'.$value['developer'].'）';
             $string[] = array('title'=>$title,'id'=>$value["newshouse_id"],'inputname'=>$value["title"]);
 
     }
     echo json_encode(array('data'=>$string));
 
     exit;
     /**
      * 返回城市下面的区域数据
      */
 }